using System.Collections.Generic;
using UnityEngine;
using Debug = UnityEngine.Debug;

public abstract class Card
{
    // 基础属性
    public string id { get; protected set; }
    public string name { get; protected set; }
    public string description { get; protected set; }
    public int energyCost { get; protected set; }
    public CardType cardType { get; protected set; }
    public Rarity rarity { get; protected set; }
    public TargetType targetType { get; protected set; }

    // 系统引用
    protected CardManager cardManager;
    protected EffectSystem effectSystem;

    public Card(CardManager cm, EffectSystem es)
    {
        cardManager = cm;
        effectSystem = es;
        InitializeCard();
    }

    protected abstract void InitializeCard();

    // 修改：使用 ITarget 而不是具体的 PlayerData
    public abstract void OnUse(ITarget user, List<ITarget> targets);

    public abstract Card Clone();

    public virtual string GetDescription()
    {
        return description;
    }

    // 检查卡牌是否可以使用的通用方法
    public virtual bool CanUse(ITarget user, List<ITarget> targets)
    {
        // 基础检查：目标是否有效
        if (targets == null || targets.Count == 0)
        {
            if (targetType != TargetType.Self)
                return false;
        }

        return true;
    }
}